<script>
function checkColorEE(value,dom)
{
	var r=230;
	var g=230;
	var b=230;
	if(value>0)
	{
		r=r-value;
		b=b-value;
		var opa=0.5+(value/150.0)/2.0;	
		dom.parent().parent().children("#employee-ev-image-angry").css({ opacity: 1-opa });
		dom.parent().parent().children("#employee-ev-image-happy").css({ opacity: opa });
		dom.css('background', 'rgb('+r+','+g+','+b+')');
		
	}
	else
	{
		g=g+value;
		b=b+value;
		var opa=0.5-(value/150.0)/2.0;
		dom.parent().parent().children("#employee-ev-image-angry").css({ opacity: opa });
		dom.parent().parent().children("#employee-ev-image-happy").css({ opacity: 1-opa });
		dom.css('background', 'rgb('+r+','+g+','+b+')');
	}
}
$(document).ready(function()
{
	$( "#accordion" ).accordion
	({
		collapsible: true,
		animate:false,
		active:false,
	});



	$(".slider").each(function()
			{
			
				$(this).slider(
				{
					min:-150,
					max:150,
					slide: function( event, ui ) 
					{
							checkColorEE(ui.value,$(this))	
						
					}
				});
				
				$(this).css('background', 'rgb(230,230,230)');
				$(this).parent().parent().children("#employee-ev-image-happy").css({ opacity: 0.5 });
				$(this).parent().parent().children("#employee-ev-image-angry").css({ opacity: 0.5 });
				
			});

		<?php 
			$EE=$this->session->userdata("employeeev");
			
			if($EE)
			{
				
				
				foreach ($EE as $item)
				{
					$content = $item[2];
					$sus = array("\r\n", "\n\r", "\n", "\r");
					$content = str_replace($sus,'\n', $content);
				 	echo '
						$("#EERID'.$item[0].'").slider("option","value","'.$item[1].'");
						checkColorEE('.$item[1].',$("#EERID'.$item[0].'"));
						var comm=
						$("textarea#EECID'.$item[0].'").val("'.$content.'");
				
						';
				}
			}
		?>

	//	$("textarea").autosize();
	
});
</script>



<div style="text-align:center">
<h1><?php echo 'Selecciona y evalua a él o los empleados que desees' ?></h1>
<br>
</div>
<div id="accordion">
<?php 

foreach($employee as $item)
{
	echo 
	'
	
		<h3>
			<img class="employee-img" alt="eid'.$item['id'].'" src="'.base_url().$item['photo'].'"> 
			<div class="employee-name"><p>'.$item['name'].'</p></div>
		</h3>
		<div>		
	    	<div class="employee-ev-image" id="employee-ev-image-angry"></div>
			<div class="employee-ev-slider"><div class="slider" id="EERID'.$item['id'].'" EERID="'.$item['id'].'"></div></div>
			<div class="employee-ev-image" id="employee-ev-image-happy"></div>
	
			<div class="h-line"></div>
			<h2 style="width:100%;text-align:center;">Comentario</h2>
			<textarea  id="EECID'.$item['id'].'" EECID="'.$item['id'].'" style="margin:0 auto;width:100%;height:100px;color:black;border-radius:5px 5px 5px 5px;font-size:11px"></textarea>					
	    </div>    		
	
	';
}

?>
</div>






